import wxpyview.ui.core.dataprovider.common.library

def getData(dom_element):
    return _object2array(dom_element)

def _object2array(dom_element):
    data = []
    
    if dom_element.nodeType != dom_element.ELEMENT_NODE:
        raise IOException
    
    if dom_element.nodeName != "wx:ArrayCollection":
        raise IOException
    
    for child_dom in dom_element.childNodes:
        if child_dom.nodeType != child_dom.ELEMENT_NODE: continue
        
        if child_dom.nodeName == "wx:Object":
            data.append(wxpyview.ui.core.dataprovider.common.library.object2hash(child_dom))
        elif child_dom.nodeName == "wx:ArrayCollection":
            data.append(_object2array(child_dom))
            
    return data